Passed
Push — main ( 5cacf5...da0f78 )
by Pedro
02:28
created

part.ts ➔ concatenate   A

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 2
crap 6
1
/*
2
 * decimal.js-i18n v0.2.6
3
 * Full internationalization support for decimal.js.
4
 * MIT License
5
 * Copyright (c) 2022 Pedro José Batista <[email protected]>
6
 * https://github.com/pjbatista/decimal.js-i18n
7
 */
8
import type FormatPartTypes from "./partTypes";
9
10
// Filters:
11 1
export const decimals = <T extends PartType>({ type }: T) => type === "decimal";
12 82723
export const exponents = <T extends PartType>({ type: t }: T) => t === "exponentInteger" || t === "exponentMinusSign";
13 82723
export const fractions = <T extends PartType>({ type }: T) => type === "fraction";
14 83084
export const integerGroups = <T extends PartType>({ type }: T) => type === "integer" || type === "group";
15 61984
export const integers = <T extends PartType>({ type }: T) => type === "integer";
16
17
/** Object used to describe a single transliteration part of `Decimal.Format.formatToParts`. */
18
export type FormatPart = PartType & PartValue;
19
20
/** Fragment of a part containing the type. */
21
export interface PartType {
22
    /** A string describing the formatting part. */
23
    type: Intl.NumberFormatPartTypes | FormatPartTypes;
24
}
25
26
/** Fragment of a part containing the value. */
27
export interface PartValue {
28
    /** Localized string with a fragment of the result. */
29
    value: string;
30
}
31
32
export default FormatPart;
33